//
//  GeDiaoScrollView.m
//  Style
//
//  Created by dllo on 15/9/23.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#define ScreenWidth          [[UIScreen mainScreen] bounds].size.width
#define ScreenHeight         [[UIScreen mainScreen] bounds].size.height
#define ViewWidth(v)                        v.frame.size.width
#define ViewHeight(v)                       v.frame.size.height


#import "GeDiaoScrollView.h"


@interface GeDiaoScrollView () <UIScrollViewDelegate>

@end

@implementation GeDiaoScrollView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        /* 设置UIScrollView属性 */
        self.contentSize = CGSizeMake(ScreenWidth * 10, 0);
        self.pagingEnabled = YES;
        self.showsHorizontalScrollIndicator = NO;
        self.bounces = NO;
        self.userInteractionEnabled = YES;
        self.scrollEnabled = YES;
        
         NSString *dateTime = [self getCurrentTime];
        /* 在UIScrollView上添加MainTableView */
        for (int i = 0; i < 10; i++) {
            self.urlStr = [NSString stringWithFormat:@"http://bea.wufazhuce.com/OneForWeb/one/getHp_N?strDate=%@&strRow=%d", dateTime, i + 1];
            
            self.GEDIAOTableview = [[GeDiaoTableview alloc] initWithFrame:CGRectMake(i * ScreenWidth, 0, ScreenWidth, ScreenHeight + 100) style:UITableViewStylePlain];
            [self addSubview:self.GEDIAOTableview];
            self.GEDIAOTableview.modelCount = i;
            
            
            self.GEDIAOTableview.UrlStr = self.urlStr;
            
            [self.GEDIAOTableview dataHandle];
            

        }
        
        self.mData = [NSMutableData data];
    
    }
    
    return self;

}


/* 获取当天日期方法 */
- (NSString *)getCurrentTime
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
    NSString *dateTime = [dateFormatter stringFromDate:[NSDate date]];
    return dateTime;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
